﻿/*
* Copyright (C) 2023 ~ 2033 Ltd.
*
* Author:     helei <2454264168@qq.com>
*
* Maintainer: helei <2454264168@qq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* General Public License version 3 as published by the Free Software
* Foundation and appearing in the file LICENSE.MIT included in the
* packaging of this file.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef USCOREWIDGET_H
#define USCOREWIDGET_H

#include "utkwidget_export.h"

#include <QWidget>

class UFivePointedStarPrivate;
class UTKWIDGET_EXPORT UFivePointedStar : public QWidget
{
    Q_OBJECT
public:
    explicit UFivePointedStar(QWidget* parent = nullptr);
    explicit UFivePointedStar(double percentage, QWidget* parent = nullptr);
    ~UFivePointedStar();

    void setPercentage(double percentage);

    double percentage() const;

    void rotate(double angle);

signals:
    void mousePressed();

    void mouseReleased();

    void mouseClicked();

protected:
    void mousePressEvent(QMouseEvent* event) override;

    void mouseReleaseEvent(QMouseEvent* event) override;

    void paintEvent(QPaintEvent* event) override;

private:
    QScopedPointer<UFivePointedStarPrivate> d_ptr;
    Q_DISABLE_COPY(UFivePointedStar)
    Q_DECLARE_PRIVATE_D(d_ptr, UFivePointedStar)
};

class UScoreWidgetPrivate;
class UTKWIDGET_EXPORT UScoreWidget : public QWidget
{
    Q_OBJECT
public:
    explicit UScoreWidget(QWidget* parent = nullptr);
    explicit UScoreWidget(int count, QWidget* parent = nullptr);
    ~UScoreWidget();

    void setLabelVisible(bool isVisible);

    void setScoreValue(double value);

    void setCount(int count);

    int count() const;

private slots:
    void onMouseClicked();

private:
    QScopedPointer<UScoreWidgetPrivate> d_ptr;
    Q_DISABLE_COPY(UScoreWidget)
    Q_DECLARE_PRIVATE_D(d_ptr, UScoreWidget)
};

#endif // USCOREWIDGET_H
